@extends('admin.layout.layout')
@section('content')

<div class="container-fluid animatedParent animateOnce">
    <div class="mt-2 shadow card">
        <div class="container-fluid pb-3 pt-3">
                <h3 class="mb-2">未曾注册的控制器方法</h3>
                <div>
                    @forelse ($invalid as $item)
                        <span class="badge badge-secondary  mb-2 mr-2 gradient">
                            {{$item['controller_name']}}
                            --
                            {{$item['method_name']}}
                        </span>
                    @empty
                        <span class="badge">没有未注册的控制器方法</span>
                    @endforelse
                </div>
        </div>
    </div>
    <div class="tab-pane animated fadeInUpShort show active go" id="v-pills-all" role="tabpanel" aria-labelledby="v-pills-all-tab">
        <div class="mt-3">
                <h3 class="mt-4">路由菜单列表</h3>
                <button type="button" class="btn btn-success btn-sm open-all" onclick="$('.menu-list ul').show();$('.menu-list li').addClass('on');">全部展开</button>
                <button type="button" class="btn btn-info btn-sm open-all" onclick="$('.menu-list ul').hide();$('.menu-list li').removeClass('on');">全部收起</button>
                <button type="button" data-mini="{{url('/admin/menu/create')}}" data-title="新增菜单" class="btn btn-primary btn-sm">新增菜单</button>
                <button type="button" class="btn btn-danger btn-sm deleteChecked">删除已选</button>
                <input type="hidden" class="deleteIds">
                <input type="hidden" class="deleteNames">
        </div>
        @component('admin.components.tree',['pageListData'=>$pageListData])
        @endcomponent
    </div>
</div>
    <script>
        $(".deleteChecked").click(function(){
            var ids=$(".deleteIds").val();
            var names=$(".deleteNames").val();
            if(!ids){
                toastr.info('无已选菜单');
                return false;
            }
            swal("是否删除"+names,{
                dangerMode: true,
                icon:"warning",
                buttons: {
                    cancel: "取消",
                    danger: {
                        text:"确定",
                    },
                }
            })
            .then((value) => {
                    if(value==='danger'){
                        $.post('{{url("/admin/menu/deleteChecked")}}',{ids:ids,_token:'{{csrf_token()}}'},function(res){
                             if(res.status===200){
                                toastr.success(res.msg);
                                setTimeout(function(){
                                    window.location.reload();
                                },1500)
                             }else{
                                 toastr.info(res.msg);
                             }
                        })
                    }
            });
        });
    
    </script>
  
@endsection